package per.hnvcam.searchext.data.model;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Vi Cam
 * Date: 24/12/2011
 * Time: 23:15
 * To change this template use File | Settings | File Templates.
 */
public class RuleData {
   private String classifiedClass;
   private List<ConditionData> conditions;

   public RuleData() {
      conditions = new ArrayList<ConditionData>();
   }

   public String getClassifiedClass() {
      return classifiedClass;
   }

   public void setClassifiedClass(String classifiedClass) {
      this.classifiedClass = classifiedClass;
   }

   public List<ConditionData> getConditions() {
      return conditions;
   }

   public void setConditions(List<ConditionData> conditions) {
      this.conditions = conditions;
   }

   @Override
   public String toString() {
      String result = "IF ";
      boolean first = true;
      for (ConditionData condition : this.conditions) {
         if (!first) {
            result += "AND ";
         } else {
            first = false;
         }
         result += condition.getWord() + " = " + condition.getFuzzyAmount() + " ";
      }
      result += "THEN class = " + this.classifiedClass;
      return result;
   }
}
